import axios from '@/plugins/axios'

// 首页登录
export async function getPcLogin (params) {
  try {
    let res = await axios.post(`/app/staff/login/pcLogin`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err
  }
}

// 设置密码
export async function getSetPassword (params) {
  try {
    let res = await axios.post(`/app/staff/check/setPassword`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err
  }
}

// 重置密码
export async function getResetPassword (params) {
  try {
    let res = await axios.post(`/app/staff/check/resetPassword`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err
  }
}

// 查询是否有密码
export async function getQueryPassword () {
  try {
    let res = await axios.get(`/app/staff/check/passwordPage`)
    return res.data
  } catch (err) {
    console.log(err)
    return err
  }
}

// 登出
export async function checkLoginOut (params) {
  try {
    let res = await axios.post(`/app/staff/check/loginOut`, params)
    return res.data
  } catch (err) {
    console.log(err)
    return err.response.data
  }
}

// 关注公众号二维码
export async function staffQrCode (url) {
  try {
    let res = await axios({
      method: 'post',
      url: '/app/staff/qrCode/qrCode',
      data: url,
      responseType: 'blob'
    })
    return res.data
  } catch (error) {
    console.log(error)
  }
}

// 绑定面试官微信（接受消息第二步）
export async function staffWxBindUrl (url) {
  try {
    let res = await axios({
      method: 'post',
      url: '/app/staff/qrCode/wxBindUrl',
      data: url,
      responseType: 'blob'
    })
    return res.data
  } catch (error) {
    console.log(error)
  }
}
